package vn.appsmobi.activity;

import vn.appsmobi.R;
import vn.appsmobi.ui.SearchFragment;
import vn.appsmobi.ulti.Constant;
import vn.appsmobi.ulti.Log;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.Menu;
import android.view.inputmethod.InputMethodManager;

public class SearchActivity extends BaseActivity {

	@Override
	protected Fragment newFragmentByTag(String tag)
	  {	 
		Log.v("FRAGMENT_TAG_DETAIL");
		Fragment searchFragment = null;
	    if (TextUtils.equals(tag, Constant.FRAGMENT_TAG_SEARCH))
	    {
	       searchFragment = new SearchFragment();	     
	    }
		return searchFragment;
	    
	  }
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if(null == savedInstanceState)
		{
			super.setDisplayShowCustomEnabled(true);
			showFragment(Constant.FRAGMENT_TAG_SEARCH, savedInstanceState, false);
		}
		
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.search, menu);
		return true;
	}

	/* (non-Javadoc)
	 * @see com.cdn.allmobilestore.activity.BaseActivity#onBackPressed()
	 */
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		super.onBackPressed();
		InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY,0);
		
	}
	
	

}
